#include "netcli.hpp"
#include <arpa/inet.h>
#include <cstring>
#include <iostream>
#include <netinet/in.h>
#include <sys/socket.h>
#include <unistd.h>

#define BUFFER_SIZE 1024

int main()
{
    int cnt = 0;
    char buffer[BUFFER_SIZE];
    char ip[16] = "127.0.0.1";

    std::string cmd1("hello");

    netcli cli(ip, 8080);

    while (cnt < 100) {
        cli.netsend(cmd1.data(), cmd1.length());

        memset(buffer, 0, BUFFER_SIZE);
        cli.netrecv(buffer, BUFFER_SIZE);
        std::cout << buffer << " : " << cnt << std::endl;

        cnt++;

        usleep(40 * 1000);
    }

    return 0;
}
